package org.pas.fb2.tag;

public class StyleTag extends Textual {

    static final String NAME = "style";

    StyleTag(Tag parent) {
        super(parent);
    }

    @Override
    public String getName() {
        return NAME;
    }

    protected char[] getPrefix() {
        return null;
    }

    protected char[] getPostfix() {
        return null;
    }

    @Override
    protected void doClose() {
        char[] prefix = getPrefix();
        if (prefix != null && prefix.length > 0) {
            getParent().onChars(prefix, 0, prefix.length);
        }

        char[] text = getText().toString().toCharArray();
        if (text.length > 0) {
            getParent().onChars(text, 0, text.length);
        }

        char[] postfix = getPostfix();
        if (postfix != null && postfix.length > 0) {
            getParent().onChars(postfix, 0, postfix.length);
        }

    }
}
